package ArrayListStudey;

import java.util.ArrayList;
import java.util.Iterator;

public class Study1 {
    public static void main(String[] args) {
        ArrayList Data1 = new ArrayList();
        Data1.add("学习集合框架");
        Data1.add(22);
        Data1.add(22.2);
        Data1.add(true);
        //查找
        System.out.println("Data1.get(2) = " + Data1.get(2));
        //for循环
        for (int i = 0; i <Data1.size() ; i++) {
            System.out.println("Data1.get("+i+") = " + Data1.get(i));
        }
        //foreach 高阶for
        for (Object ele:Data1){
            System.out.println("ele = " + ele);
        }
        Data1.remove(1);//删除
        //迭代器
        Iterator iterator = Data1.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println("next = " + next);
        }

    }
}
